# try-except-else

try:
    1 / 0
except:
    print("逮到了～")
else:
    print("没逮到～")

try:
    1 / 1
except:
    print("逮到了～")
else:
    print("没逮到～")

# try-except-finally
try:
    1 / 0
except:
    print("逮到了～")
else:
    print("没逮到～")
finally:
    print("逮没逮到都会吱一声")

try:
    f = open("./doc/FishC.txt", "w")
    f.write("I love FishC")
except:
    print("出错了～")
finally:
    f.close()

# try:
#     while True:
#         pass
# finally:
#     print("晚安～")


# 异常的嵌套
try:
    try:
        502 + "Fish"
    except:
        print("内部异常！")

    1 / 0
except:
    print("外部异常！")
finally:
    print("首位工作")
